Draft
Conversation
Add a new tool at tools/token-metrics that extracts quantitative metrics from @adobe/spectrum-tokens to support the OKR: 'Token metrics are defined and included into our metrics system & have a baseline to compare moving forward.' Metrics extracted from the current token data: - Token inventory: 2,338 total (2,150 active, 188 deprecated) - Token scope: 965 global, 1,373 component-scoped across 95 components - Architecture: 654 aliases, 459 direct-value, 1,225 set-based - Data quality: 100% UUID coverage, max alias depth 4 - Component coverage: 44/54 registered components have tokens (81.5%) - Semantic categories: layout (741), content (289), typography (284), color (227), background (151), border (58), shadow (23) Includes: - src/index.js: Core metrics extraction library with exported functions - src/cli.js: CLI tool for generating reports - test/index.test.js: 21 unit and integration tests (all passing) - README.md: Documents all metrics, their meaning, and recommended timeline for Alison and the team - token-metrics-report.json: Baseline snapshot from current data - moon.yml, ava.config.js, package.json: Standard tooling config
|
Cursor Agent can help with this pull request. Just |
|
Member
Author
Run report for f68c4a5bTotal time: 7.1ms | Comparison time: 0s | Estimated loss: 7.1ms (100.0% slower)
Touched files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new CLI tool located at
tools/token-metricsto extract and report quantitative metrics from@adobe/spectrum-tokens. The tool provides a comprehensive baseline analysis of the design token system, covering inventory, scope, architecture, data quality, and component coverage. It generates both a human-readable summary (printed to stdout) and a machine-readable JSON report (token-metrics-report.json).Related Issue
This addresses the Spectrum OKR: "Token metrics are defined and included into our metrics system & have a baseline to compare moving forward." Specifically, it provides a concrete answer to Alison's question: "what does this mean specifically, and when should this be done by?"
Motivation and Context
The primary motivation is to establish a clear, quantifiable understanding of the current state of Spectrum's design token system. This baseline is crucial for:
How Has This Been Tested?
tools/token-metrics/test/index.test.js) cover all core utility functions and metric computations.computeMetricsagainst the actualpackages/tokens/srcdirectory to ensure real-world data processing.token-metrics-report.jsonand verify the summary output.Screenshots (if appropriate):
N/A (CLI tool, output is text/JSON). The generated
token-metrics-report.jsonserves as an example output.Types of changes
Checklist: